#include "StdAfx.h"
#include "TLine.h"
#include "TPolyLine.h"
#include "TGeometry.h"
#include "TQuadric.h"

TGeoImp*  TGeometry::CreateLine( const TLine& line )
{
	return new TLine(line);
}

TGeoImp* TGeometry::CreatePolyLine( const TPolyLine &polyline )
{
	return new TPolyLine(polyline);
}

TGeoImp* TGeometry::CreateGeometry( const TGeoImp* imp )
{
	TGeoImp * result = NULL;
	switch (imp->Type())
	{
	case TGeoImp::eLine:
		result = (TGeoImp*) new TLine(*(TLine*)imp);
		break;
	case TGeoImp::ePoly:
		result = (TGeoImp*) new TPolyLine(*(TPolyLine*)imp);
		break;
	case TGeoImp::eSphere:
		result = (TGeoImp*) new TSphere(*(TSphere*)imp);
		break;
	case TGeoImp::eCylinder:
		result = (TGeoImp*) new TCylinder(*(TCylinder*)imp);
		break;
	case TGeoImp::eDisk:
		result = (TGeoImp*) new TDisk(*(TDisk*)imp);
		break;
	default:
		break;
	}
	return result;
}